import com.alibaba.fastjson.JSON;
import com.aliyun.facebody20191230.models.RecognizeActionRequest;
import com.aliyun.facebody20191230.models.RecognizeActionResponse;
import com.aliyun.teaopenapi.models.Config;

public class ALiBodyActionTest {
    /**
     * 使用AK&SK初始化账号Client
     * @param accessKeyId
     * @param accessKeySecret
     * @return Client
     * @throws Exception
     */
    public static com.aliyun.facebody20191230.Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
        Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId("LTAI5tQzFwtRgiGYvn2o8TTn")
                // 您的AccessKey Secret
                .setAccessKeySecret("tcQNHJqPWOtWEzBNMn4Vxv3XCsH9Bj");
        // 访问的域名
        config.endpoint = "facebody.cn-shanghai.aliyuncs.com";
        return new com.aliyun.facebody20191230.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.facebody20191230.Client client = ALiBodyActionTest.createClient("accessKeyId", "accessKeySecret");
        RecognizeActionRequest recognizeActionRequest = new RecognizeActionRequest()
                .setType(0) //type为0表示输入输入视频URL或视频Base64编码字符串，为1表示输入图像URL或图像Base64编码字符串。
                .setVideoUrl("https://wangkun123.oss-cn-shanghai.aliyuncs.com/2021/07/09/VID_20210709_103443.mp4");
        // 复制代码运行请自行打印 API 的返回值
        RecognizeActionResponse recognizeActionResponse = client.recognizeAction(recognizeActionRequest);
        System.out.println(JSON.toJSONString(recognizeActionResponse));
    }
}
